package com.example.sport.ui.home;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
//import androidx.fragment.app.Fragment;

import com.example.sport.Class.ClassAdapter;
import com.example.sport.Class.ClassList;
import com.example.sport.R;
import com.example.sport.ui.BaseFragment;

import java.util.ArrayList;
import java.util.List;

public class CourseFragment extends BaseFragment {
    List<ClassList> classLists=new ArrayList<>();
    private View view;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

            initClasses();
            RecyclerView recyclerView=(RecyclerView)view.findViewById(R.id.recyclerView1);
            GridLayoutManager layoutManager=new GridLayoutManager(context,2);
            recyclerView.setLayoutManager(layoutManager);
            layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
            ClassAdapter adapter=new ClassAdapter(classLists);
            recyclerView.setAdapter(adapter);
            return   inflater.inflate(R.layout.fragment_h, container, false);

    }

        private void initClasses() {
            for (int i = 0; i < 2; i++) {
                ClassList class1=new ClassList("Apple",R.drawable.pic1_1_1);
                classLists.add(class1);

            }
        }

}
